 /* *********************************************************************
 * MODULE NAME:    hid_core.c
 * DESCRIPTION:    Hid profile basic messages intercommunication
 * MAINTAINER:     Chen bo
 *
 * 
 * LICENSE:
 *     This source code is copyright (c) 2009 RDA Ltd.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 * 
 *
 * ISSUES:
 * 
 ***********************************************************************/
#ifndef HID_CORE_H
#define HID_CORE_H


#include "hid.h"





#define BT_HID_PROTOCOL_VERSION              0x9100
#define PRH_HFP_SUPPORTED_FEATURES        0x00


typedef void (*t_hid_process_rxData)(HID* hid,u_int16 cid,u_int32 packet_size, const u_int8 *ptr );


void  HID_Initial(void);



//t_api  HID_Layer_Ctrl(u_int8 flags);

void HID_RegisterPSM(u_int16 psm);

void HID_DeRegisterPSM(u_int16 psm);

//void HID_Connect(HID *hid ,t_bdaddr device_addr, u_int16 psm);

void HID_Send_Handshake_Packes(HID_HANDSHAKE_MESSAGE message);

void HID_SetReport_Response(HID *hid,  HID_HANDSHAKE_MESSAGE status);

void HID_SetIdle_Response(HID *hid, HID_HANDSHAKE_MESSAGE status);

void HID_SetProtocol_Response(HID *hid, HID_HANDSHAKE_MESSAGE status);

void HID_GetProtocol_Response(HID *hid, HID_HANDSHAKE_MESSAGE status, HID_PROTOCOL protocol);

void HID_GetIdle_Response(HID *hid, HID_HANDSHAKE_MESSAGE status, u_int8 idle_rate);

void HID_GetReport_Response(HID *hid, HID_HANDSHAKE_MESSAGE status, HID_REPORT_TYPE report_type, u_int16 report_length, const u_int8 *data);

//void HID_Disconnect(HID *hid, u_int16 psm);

boolean HID_ConnIsConnected(void);

//void HID_Handle_Received_Data(HID* hid,u_int16 cid,u_int32 packet_size, const u_int8 *ptr );


//void HID_Packet_Send_Interrupt(u_int8 header, const u_int8 *data, u_int32 length);
//void HID_Packet_Send_Interrupt(u_int8 header, const u_int8 *data, u_int32 length);


void HID_Packet_Send_Control(u_int8 header, const u_int8 *data, u_int32 length);

void HID_Send_Control_Op_Unplug(HID_CONTROL_OP op);

void Hid_Handle_Received_Data(HID* hid,u_int16 cid,u_int32 packet_size, const u_int8 *ptr );

void HID_Handle_Control_Message(HID *hid, HID_CONTROL_OP operation);

HidPacketStatus HidPacketStart(HID *hid, u_int16 packet, const u_int8 *data, u_int32 length);

HidPacketStatus HidPacketAppend(HID *hid, const u_int8 *data, u_int32 length);




#ifdef __cplusplus
extern "C" {
#endif


APIDECL1 t_api APIDECL2 HID_Connect(t_bdaddr device_addr);
APIDECL1 t_api APIDECL2 HID_Disconnect(void);


APIDECL1 t_api APIDECL2 HID_Packet_Send_Interrupt(u_int8 header, const u_int8 *data, u_int32 length,u_int8 flag);

#ifdef __cplusplus
} /* extern "C"  */
#endif

#endif



